#!/bin/bash -e
unamestr=$(uname)
if [[ "$unamestr" == 'Linux' ]]; then
  DIR=$(dirname $(readlink -f $0))
elif [[ "$unamestr" == "Darwin" ]]; then
  cmd=$(which "$0")
  if [ -L "$cmd" ]; then
    cmd=$(readlink "$cmd")
  fi
  DIR=$(dirname "$cmd")
else
  echo "Only Linux and Mac OS X are supported!"
  exit
fi

unset PYTHONPATH
source $DIR/venv/bin/activate
exec /usr/bin/env python $DIR/middleware/qira.py $*
